package file;

import java.io.File;

public class ListFileDemo {
    public static void main(String[] args) {
        File dir = new File(".");
        if(dir.isDirectory()){
            File[] subs = dir.listFiles();
            System.out.println("一共:"+subs.length+"个文件");
//            for (int i = 0; i < subs.length; i++) {
//                System.out.println("文件名："+subs[i]);
            for(File sub:subs){
                System.out.println(sub.getName());

            }
        }
    }
}
